home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 11
/
FM Towns Free Software Collection 11.iso
/
t_os
/
tool
/
genji
/
src
/
genji.c
< prev
next >
Wrap
Text File
|
1995-08-13
|
8KB
|
317 lines
/*
源二郎 v2.1a (GUI Version) By SAKU
[tabsize 4]
*/
#include "genji.h"
char egbwork[1536];
char moswork[4096];
void buttonLoop( int b1, int cx, int cy );
void egbInit();
void egbTerm();
void mouseInit();
void mouseTerm();
char *simpleSTR( int n );
int main( int argc, char *argv[] )
{
int bflg = OFF;
int dflg = OFF;
int pflg = OFF;
char defname[64] = "GENJI.DEF";
char pdrname[64];
int i,j,bt_exe,bt_pdr,bt_def,bt_end,bt_pag,bt_tab,bt_lef,bt_lin,bt[16];
int sw,cx,cy;
char buf[64];
double a;
egbInit();
mouseInit();
BT_init( egbwork );
VC_init( egbwork, 8, 240, 78, 10, 15, 1 );
EGB_foreColor( egbwork, 2 );
EGB_paintMode( egbwork, 0x02 );
EGB_box( egbwork, 7, 239, 633, 401 );
++ argv;
-- argc;
while(1)
{
if( **argv != '-' && **argv != '/' )
break;
++ *argv;
-- argc;
switch( **argv )
{
case 'D':
case 'd':
dflg = ON;
++ *argv;
strcpy( defname, *argv );
break;
case 'B':
case 'b':
bflg = ON;
break;
default:
VC_printf( "'%s' is not proper option.\n", POINTER, *argv );
break;
}
++ argv;
}
if( argc > 0 )
{
strcpy( pdrname, *argv );
pflg = ON;
}
/*------------------------- < SELLECT IN GUI > ------------------------*/
bt[0] = bt_exe = BT_create( 1, 0, 40, 120, 20, "‡印刷実行‡" );
bt[1] = bt_pdr = BT_create( 1, 0, 0, 120, 20, "印刷ファイル" );
bt[2] = bt_def = BT_create( 1, 0, 20, 120, 20, "設定ファイル" );
bt[3] = bt_end = BT_create( 1, 0,140, 120, 20, "源二郎★終了" );
bt[4] = bt_pag = BT_create( 1, 0, 60, 120, 20, "ページ印字" );
bt[5] = bt_tab = BT_create( 1, 0, 80, 120, 20, "タブサイズ" );
bt[6] = bt_lef = BT_create( 1, 0,100, 120, 20, "レフトマージン" );
bt[7] = bt_lin = BT_create( 1, 0,120, 120, 20, "1ページ行数" );
LABEL10:
if( setInit( defname ) )
VC_printf( "定義ファイル\"%s\"が読み込めません。\n", POINTER, defname );
EGB_paintMode( egbwork, 0x22 );
EGB_foreColor( egbwork, 0 );
EGB_paintColor( egbwork, 0 );
EGB_box( egbwork, 120, 0, 220, 140 );
EGB_foreColor( egbwork, 15 );
if( pflg == ON )
symbol( egbwork, 122, 18, pdrname );
symbol( egbwork, 122, 38, defname );
if( writepage == ON )
symbol( egbwork, 122, 78, "する" );
else
symbol( egbwork, 122, 78, "しない" );
symbol( egbwork, 122, 98, simpleSTR(tabsize) );
symbol( egbwork, 122,118, simpleSTR(leftmargin) );
if( lpp == 0 )
symbol( egbwork, 122,138, "無設定" );
else
symbol( egbwork, 122,138, simpleSTR(lpp) );
EGB_paintMode( egbwork, 0x02 );
sw = 0;
MOS_disp( 1 );
while( 1 )
{
MOS_rdpos( &sw, &cx, &cy );
for( i=0; i<8; i++ )
buttonLoop( bt[i], cx, cy );
if( sw == 1 )
{
if( BT_check( bt_exe, cx, cy ) == BTC_ON )
{
MOS_disp( 0 );
genji_mainPG( pdrname, defname, bflg );
MOS_disp( 1 );
}
if( BT_check( bt_end, cx, cy ) == BTC_ON )
break;
if( BT_check( bt_pdr, cx, cy ) == BTC_ON )
{
VC_printf( "印刷ファイルを選んでください。\n" );
FS_locate( 120, 0 );
FS_fileSelect( egbwork, "*.*", pdrname );
EGB_paintMode( egbwork, 0x22 );
EGB_foreColor( egbwork, 0 );
EGB_paintColor( egbwork, 0 );
EGB_box( egbwork, 120, 0, 639, 20 );
EGB_paintMode( egbwork, 0x02 );
EGB_foreColor( egbwork, 15 );
symbol( egbwork, 122, 18, pdrname );
MOS_disp( 1 );
}
if( BT_check( bt_def, cx, cy ) == BTC_ON )
{
VC_printf( "設定ファイルを選んでください。\n" );
FS_locate( 120, 0 );
FS_fileSelect( egbwork, "*.*", defname );
EGB_paintMode( egbwork, 0x22 );
EGB_foreColor( egbwork, 0 );
EGB_paintColor( egbwork, 0 );
EGB_box( egbwork, 120, 20, 639, 40 );
EGB_paintMode( egbwork, 0x02 );
EGB_foreColor( egbwork, 15 );
symbol( egbwork, 122, 38, defname );
MOS_disp( 1 );
goto LABEL10;
}
if( BT_check( bt_pag, cx, cy ) == BTC_ON )
{
i = BT_create( 1, 120, 60, 60, 20, "する" );
j = BT_create( 1, 180, 60, 60, 20, "しない" );
while( sw == 1 )
MOS_rdpos( &sw, &cx, &cy );
while(1)
{
MOS_rdpos( &sw, &cx, &cy );
buttonLoop( i, cx, cy );
buttonLoop( j, cx, cy );
if( sw == 1 )
{
if( BT_check( i, cx, cy ) == BTC_ON )
{
writepage = ON;
break;
}
if( BT_check( j, cx, cy ) == BTC_ON )
{
writepage = OFF;
break;
}
}
}
BT_disappear( i );
BT_disappear( j );
EGB_paintMode( egbwork, 0x22 );
EGB_foreColor( egbwork, 0 );
EGB_paintColor( egbwork, 0 );
EGB_box( egbwork, 120, 60, 639, 80 );
EGB_paintMode( egbwork, 0x02 );
EGB_foreColor( egbwork, 15 );
if( writepage == ON )
symbol( egbwork, 122, 78, "する" );
else
symbol( egbwork, 122, 78, "しない" );
}
if( BT_check( bt_tab, cx, cy ) == BTC_ON )
{
ST_locate( 120, 80 );
if( ST_inputStrings( egbwork, buf, 64, "タブサイズ" ) > 0 )
{
if( calcvalue( buf, &a ) == 0 )
{
i = a;
if( i>0 && i<9 )
{
tabsize = i;
EGB_paintMode( egbwork, 0x22 );
EGB_foreColor( egbwork, 0 );
EGB_paintColor( egbwork, 0 );
EGB_box( egbwork, 120, 80, 639, 100 );
EGB_paintMode( egbwork, 0x02 );
EGB_foreColor( egbwork, 15 );
symbol( egbwork, 122, 98, simpleSTR(tabsize) );
}
}
}
}
if( BT_check( bt_lef, cx, cy ) == BTC_ON )
{
ST_locate( 120, 100 );
if( ST_inputStrings( egbwork, buf, 64, "レフトマージン" ) > 0 )
{
if( calcvalue( buf, &a ) == 0 )
{
i = a;
if( i>-1 && i<81 )
{
leftmargin = i;
EGB_paintMode( egbwork, 0x22 );
EGB_foreColor( egbwork, 0 );
EGB_paintColor( egbwork, 0 );
EGB_box( egbwork, 120, 100, 639, 120 );
EGB_paintMode( egbwork, 0x02 );
EGB_foreColor( egbwork, 15 );
symbol( egbwork, 122,118, simpleSTR(leftmargin) );
}
}
}
}
if( BT_check( bt_lin, cx, cy ) == BTC_ON )
{
ST_locate( 120, 120 );
if( ST_inputStrings( egbwork, buf, 64, "1ページ行数" ) > 0 )
{
if( calcvalue( buf, &a ) == 0 )
{
i = a;
if( i<0 )
i = 0;
lpp = i;
EGB_paintMode( egbwork, 0x22 );
EGB_foreColor( egbwork, 0 );
EGB_paintColor( egbwork, 0 );
EGB_box( egbwork, 120, 120, 639, 140 );
EGB_paintMode( egbwork, 0x02 );
EGB_foreColor( egbwork, 15 );
if( lpp == 0 )
symbol( egbwork, 122,138, "無設定" );
else
symbol( egbwork, 122,138, simpleSTR(lpp) );
}
}
}
while( sw == 1 )
MOS_rdpos( &sw, &cx, &cy );
}
}
/*---------------------------------------------------------------------*/
mouseTerm();
egbTerm();
end_();
return 0;
}
void egbInit()
{
EGB_init( egbwork, 1536 );
EGB_resolution( egbwork, 0, 3 );
EGB_resolution( egbwork, 1, 3 );
EGB_displayPage( egbwork, 0, 3 );
EGB_writePage( egbwork, 1 );
return;
}
void egbTerm()
{
MOS_screenterm( egbwork );
return;
}
void mouseInit()
{
MOS_start( moswork, 4096 );
MOS_sysIcon( 81, 0, 0, 0 );
MOS_writePage( 0 );
MOS_color( 0, 15 );
return;
}
void mouseTerm()
{
MOS_disp( 0 );
MOS_end();
return;
}
void buttonLoop( int b1, int cx, int cy )
{
if( BT_check( b1, cx, cy ) == BTC_ON )
BT_reverse( b1, 1 );
else
BT_reverse( b1, 0 );
return;
}
char *simpleSTR( int n )
{
static char buffer[256];
sprintf( buffer, "%d", n );
return buffer;
}